#pragma once
#include <iostream>
#include <unistd.h>
#include <cstring>
#include <sys/types.h>
#include <sys/socket.h>
#include "Protocal.hpp"

class Thread_Task          //线程处理方法入口
{
public:
    Thread_Task(int sock):socket(sock){}

    void* operator()()
    {
        HttpWork it(socket);
        if (STOP)
        {
            Logmessage(WARN, "请求读取异常,取消连接");
            close(socket);
            return nullptr;           
        }
        it.PaseHttpRequest();
        it.PaseURL();

        it.BuildHttpRespose();
        if (STOP)
            Logmessage(WARN, "send 异常");
        close(socket);
        delete this;
    }

    private:
    int socket;
};


